import { createWebHistory, createRouter } from 'vue-router'
import { MailOutlined, AppstoreOutlined, SettingOutlined, HomeOutlined, FolderAddOutlined } from '@ant-design/icons-vue';

const history = createWebHistory();
const router = createRouter({
  history,
  routes: [
    {
      path: '/',
      component: () => import('@/layout/Layout'),
      redirect: '/home',
      children: [
        {
          path: '/home',
          name: 'homePage',
          component: () => import('@/pages/HomePage'),
          meta: {
            title: '视频首页'
          }
        },
        {
          path: '/details/:videoId',
          name: 'details',
          component: () => import('@/pages/VideoDetail')
        },
        {
          path: '/space/:uid',
          name: 'userSpace',
          component: () => import('@/layout/components/user/UserSpace'),
        },
        {
          path: '/member',
          name: 'member',
          component: () => import('@/layout/components/member/MemberHome'),
          redirect: '/member/index',
          children: [
            {
              path: '/member/index',
              name: 'index',
              index: '1',
              title: '首页',
              icon: MailOutlined,
              component: () => import('@/layout/components/member/Index'),
              meta: {
                title: '首页',
              }
            },
            {
              path: '/member/uploadVideo',
              name: 'uploadVideo',
              index: '2',
              title: '稿件上传',
              icon: SettingOutlined,
              component: () => import('@/layout/components/member/upload/UploadVideo'),
              meta: {
                title: '稿件上传',
              }
            },
            {
              path: '/member/content',
              name: 'contentManage',
              index: '3',
              title: '内容管理',
              icon: AppstoreOutlined,
              redirect: '/member/content/manuscript',
              meta: {
                title: '内容管理',
              },
              children: [
                {
                  path: '/member/content/manuscript',
                  name: 'manuscript',
                  index: '3-1',
                  title: '稿件管理',
                  component: () => import('@/layout/components/member/contentManager/Manuscript'),
                  meta: {
                    title: '稿件管理',
                  },
                },
                {
                  path: '/member/content/complaint',
                  name: 'complaint',
                  index: '3-2',
                  title: '申诉管理',
                  component: () => import('@/layout/components/member/contentManager/Complaint'),
                  meta: {
                    title: '申诉管理',
                  }
                },
                {
                  path: '/member/content/caption',
                  name: 'caption',
                  index: '3-3',
                  title: '字幕管理',
                  component: () => import('@/layout/components/member/contentManager/Caption'),
                  meta: {
                    title: '字幕管理',
                  }
                },
              ]
            },

          ]
        }
      ]
    },
      
    {
      path: '/404',
      name: 'locationNotFound',
      component: () => import('@/layout/locationError/404')
    },

    {
      path: '/500',
      name: 'locationError',
      component: () => import('@/layout/locationError/500')
    }
  ]
})

// 路由守卫
// router.beforeEach((to,from,next) => {
//   if(to.path == '/login') {

//   }
// })

export default router;